// 备用的循环移位实现（更简单可靠）

// 简单的字节循环移位（只支持字节边界移位）
void simple_rotate_left_bytes(unsigned char *data, size_t length, int byte_positions) {
    byte_positions = byte_positions % length;
    if (byte_positions == 0) return;
    
    unsigned char temp[256];
    int shift = byte_positions;
    
    // 备份要移动的字节
    for (int i = 0; i < shift; i++) {
        temp[i] = data[i];
    }
    
    // 移动剩余字节
    for (size_t i = 0; i < length - shift; i++) {
        data[i] = data[i + shift];
    }
    
    // 将备份的字节放到末尾
    for (int i = 0; i < shift; i++) {
        data[length - shift + i] = temp[i];
    }
}

void simple_rotate_right_bytes(unsigned char *data, size_t length, int byte_positions) {
    byte_positions = byte_positions % length;
    if (byte_positions == 0) return;
    
    // 右移等于左移(length - positions)
    simple_rotate_left_bytes(data, length, length - byte_positions);
}

// 如果需要，可以替换现有的rotate_left和rotate_right函数